//
//  UTEPedBleClientHelper.m
//  uteped_sdk
//
//  Created by mateng on 2024/2/29.
//

#import "UTEPedBleClientHelper.h"


@implementation UTEPedBleClientHelper

static UTEPedBleClientHelper* instance = nil;

+ (UTEPedBleClientHelper*) shareInstance
{
    if ( instance == nil ) {
        instance = [[UTEPedBleClientHelper alloc] init];
    }
    return instance;
}

- (id)init {
    if (self = [super init]) {
        [UTEBluetoothMgr sharedInstance].delegate = self;
        self.btDelegates = [[NSMutableArray alloc] init];
    }
    
    return self;
}

- (void)addBluetoothDelegate:(id<UTEBluetoothDelegate>)delegate {
    if ([self.btDelegates containsObject:delegate]) {
        return;
    }
    
    [self.btDelegates addObject:delegate];
}

#pragma mark - UTEBluetoothDelegate
- (void)uteBluetoothStatus:(UTEBluetoothStatus)status {
    for (id<UTEBluetoothDelegate> delegate in self.btDelegates) {
        [delegate uteBluetoothStatus:status];
    }
}

- (void)uteDiscoverDevices:(UTEModelDevice *)model {
    for (id<UTEBluetoothDelegate> delegate in self.btDelegates) {
        [delegate uteDiscoverDevices: model];
    }
}

- (void)uteDevicesStatus:(UTEDevicesStatus)status error:(NSError *)error userInfo:(NSDictionary *)info {
    for (id<UTEBluetoothDelegate> delegate in self.btDelegates) {
        [delegate uteDevicesStatus: status error:error userInfo:info];
    }
}

@end
